package com.example.thebasics;

import android.os.Bundle;
import android.app.Activity;
import android.content.Intent;
import android.view.Menu;
import android.view.View;
import android.widget.EditText;

public class AddListActivity extends Activity {
	private String nomeLista;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.nova_lista);
	}

	@Override
	public boolean onCreateOptionsMenu(Menu menu) {
		// Inflate the menu; this adds items to the action bar if it is present.
		getMenuInflater().inflate(R.menu.add_list, menu);
		return true;
	}
	
	public void adicionarLista(View v){
		EditText edtiTextNomeLista = (EditText) findViewById(R.id.editTextNomeLista);
		nomeLista = edtiTextNomeLista.getText().toString();
		Intent resultIntent = new Intent();
		resultIntent.putExtra("novaLista", nomeLista);
		setResult(Activity.RESULT_OK, resultIntent);
		finish();
		
	}
	
	public void cancelar(View v){
		finish();
	}

}
